3.1.45 \(\int \sin (e+f x) (a+b \tan ^2(e+f x))^2 \, dx\) [45]

Optimal. Leaf size=54 \[ -\frac {(a-b)^2 \cos (e+f x)}{f}+\frac {2 (a-b) b \sec (e+f x)}{f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \]

[Out]

-(a-b)^2*cos(f*x+e)/f+2*(a-b)*b*sec(f*x+e)/f+1/3*b^2*sec(f*x+e)^3/f

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 54, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {3745, 276} \begin {gather*} -\frac {(a-b)^2 \cos (e+f x)}{f}+\frac {2 b (a-b) \sec (e+f x)}{f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Sin[e + f*x]*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-(((a - b)^2*Cos[e + f*x])/f) + (2*(a - b)*b*Sec[e + f*x])/f + (b^2*Sec[e + f*x]^3)/(3*f)

Rule 276

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*(a + b*x^n)^p,
 x], x] /; FreeQ[{a, b, c, m, n}, x] && IGtQ[p, 0]

Rule 3745

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Sec[e + f*x], x]}, Dist[1/(f*ff^m), Subst[Int[(-1 + ff^2*x^2)^((m - 1)/2)*((a - b + b*ff^2*x^2)^p/x^(m
 + 1)), x], x, Sec[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rubi steps

\begin {align*} \int \sin (e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac {\text {Subst}\left (\int \frac {\left (a-b+b x^2\right )^2}{x^2} \, dx,x,\sec (e+f x)\right )}{f}\\ &=\frac {\text {Subst}\left (\int \left (2 (a-b) b+\frac {(a-b)^2}{x^2}+b^2 x^2\right ) \, dx,x,\sec (e+f x)\right )}{f}\\ &=-\frac {(a-b)^2 \cos (e+f x)}{f}+\frac {2 (a-b) b \sec (e+f x)}{f}+\frac {b^2 \sec ^3(e+f x)}{3 f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.21, size = 48, normalized size = 0.89 \begin {gather*} \frac {-3 (a-b)^2 \cos (e+f x)+b \sec (e+f x) \left (6 a-6 b+b \sec ^2(e+f x)\right )}{3 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Sin[e + f*x]*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

(-3*(a - b)^2*Cos[e + f*x] + b*Sec[e + f*x]*(6*a - 6*b + b*Sec[e + f*x]^2))/(3*f)

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(124\) vs. \(2(52)=104\).
time = 0.14, size = 125, normalized size = 2.31

method result size
derivativedivides \(\frac {b^{2} \left (\frac {\sin ^{6}\left (f x +e \right )}{3 \cos \left (f x +e \right )^{3}}-\frac {\sin ^{6}\left (f x +e \right )}{\cos \left (f x +e \right )}-\left (\frac {8}{3}+\sin ^{4}\left (f x +e \right )+\frac {4 \left (\sin ^{2}\left (f x +e \right )\right )}{3}\right ) \cos \left (f x +e \right )\right )+2 a b \left (\frac {\sin ^{4}\left (f x +e \right )}{\cos \left (f x +e \right )}+\left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )\right )-a^{2} \cos \left (f x +e \right )}{f}\) \(125\)
default \(\frac {b^{2} \left (\frac {\sin ^{6}\left (f x +e \right )}{3 \cos \left (f x +e \right )^{3}}-\frac {\sin ^{6}\left (f x +e \right )}{\cos \left (f x +e \right )}-\left (\frac {8}{3}+\sin ^{4}\left (f x +e \right )+\frac {4 \left (\sin ^{2}\left (f x +e \right )\right )}{3}\right ) \cos \left (f x +e \right )\right )+2 a b \left (\frac {\sin ^{4}\left (f x +e \right )}{\cos \left (f x +e \right )}+\left (2+\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )\right )-a^{2} \cos \left (f x +e \right )}{f}\) \(125\)
risch \(-\frac {{\mathrm e}^{i \left (f x +e \right )} a^{2}}{2 f}+\frac {{\mathrm e}^{i \left (f x +e \right )} a b}{f}-\frac {{\mathrm e}^{i \left (f x +e \right )} b^{2}}{2 f}-\frac {{\mathrm e}^{-i \left (f x +e \right )} a^{2}}{2 f}+\frac {{\mathrm e}^{-i \left (f x +e \right )} a b}{f}-\frac {{\mathrm e}^{-i \left (f x +e \right )} b^{2}}{2 f}-\frac {4 b \left (-3 a \,{\mathrm e}^{5 i \left (f x +e \right )}+3 b \,{\mathrm e}^{5 i \left (f x +e \right )}-6 a \,{\mathrm e}^{3 i \left (f x +e \right )}+4 b \,{\mathrm e}^{3 i \left (f x +e \right )}-3 a \,{\mathrm e}^{i \left (f x +e \right )}+3 b \,{\mathrm e}^{i \left (f x +e \right )}\right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}\) \(192\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(f*x+e)*(a+b*tan(f*x+e)^2)^2,x,method=_RETURNVERBOSE)

[Out]

1/f*(b^2*(1/3*sin(f*x+e)^6/cos(f*x+e)^3-sin(f*x+e)^6/cos(f*x+e)-(8/3+sin(f*x+e)^4+4/3*sin(f*x+e)^2)*cos(f*x+e)
)+2*a*b*(sin(f*x+e)^4/cos(f*x+e)+(2+sin(f*x+e)^2)*cos(f*x+e))-a^2*cos(f*x+e))

________________________________________________________________________________________

Maxima [A]
time = 0.29, size = 77, normalized size = 1.43 \begin {gather*} \frac {6 \, a b {\left (\frac {1}{\cos \left (f x + e\right )} + \cos \left (f x + e\right )\right )} - b^{2} {\left (\frac {6 \, \cos \left (f x + e\right )^{2} - 1}{\cos \left (f x + e\right )^{3}} + 3 \, \cos \left (f x + e\right )\right )} - 3 \, a^{2} \cos \left (f x + e\right )}{3 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

1/3*(6*a*b*(1/cos(f*x + e) + cos(f*x + e)) - b^2*((6*cos(f*x + e)^2 - 1)/cos(f*x + e)^3 + 3*cos(f*x + e)) - 3*
a^2*cos(f*x + e))/f

________________________________________________________________________________________

Fricas [A]
time = 2.11, size = 62, normalized size = 1.15 \begin {gather*} -\frac {3 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \cos \left (f x + e\right )^{4} - 6 \, {\left (a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - b^{2}}{3 \, f \cos \left (f x + e\right )^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

-1/3*(3*(a^2 - 2*a*b + b^2)*cos(f*x + e)^4 - 6*(a*b - b^2)*cos(f*x + e)^2 - b^2)/(f*cos(f*x + e)^3)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan ^{2}{\left (e + f x \right )}\right )^{2} \sin {\left (e + f x \right )}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)*(a+b*tan(f*x+e)**2)**2,x)

[Out]

Integral((a + b*tan(e + f*x)**2)**2*sin(e + f*x), x)

________________________________________________________________________________________

Giac [A]
time = 0.80, size = 94, normalized size = 1.74 \begin {gather*} -\frac {a^{2} f^{3} \cos \left (f x + e\right ) - 2 \, a b f^{3} \cos \left (f x + e\right ) + b^{2} f^{3} \cos \left (f x + e\right )}{f^{4}} + \frac {6 \, a b \cos \left (f x + e\right )^{2} - 6 \, b^{2} \cos \left (f x + e\right )^{2} + b^{2}}{3 \, f \cos \left (f x + e\right )^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

-(a^2*f^3*cos(f*x + e) - 2*a*b*f^3*cos(f*x + e) + b^2*f^3*cos(f*x + e))/f^4 + 1/3*(6*a*b*cos(f*x + e)^2 - 6*b^
2*cos(f*x + e)^2 + b^2)/(f*cos(f*x + e)^3)

________________________________________________________________________________________

Mupad [B]
time = 14.12, size = 126, normalized size = 2.33 \begin {gather*} -\frac {8\,a\,b+{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4\,\left (8\,a\,b-6\,a^2\right )+2\,a^2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6+{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (6\,a^2-16\,a\,b+\frac {32\,b^2}{3}\right )-2\,a^2-\frac {16\,b^2}{3}}{f\,\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^8-2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6+2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2-1\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(e + f*x)*(a + b*tan(e + f*x)^2)^2,x)

[Out]

-(8*a*b + tan(e/2 + (f*x)/2)^4*(8*a*b - 6*a^2) + 2*a^2*tan(e/2 + (f*x)/2)^6 + tan(e/2 + (f*x)/2)^2*(6*a^2 - 16
*a*b + (32*b^2)/3) - 2*a^2 - (16*b^2)/3)/(f*(2*tan(e/2 + (f*x)/2)^2 - 2*tan(e/2 + (f*x)/2)^6 + tan(e/2 + (f*x)
/2)^8 - 1))

________________________________________________________________________________________